<?php

namespace App\Kuafu\CustomerCoupon\Enum;

use App\Kuafu\Base\Enum\BaseCodeEnum;
use App\Kuafu\Order\Enum\CodeEnum as orderCodeEnum;

class CodeEnum extends BaseCodeEnum
{
    const COUPON_TYPE_CASH     = 1;
    const COUPON_TYPE_EXCHANGE = 2;
    const COUPON_TYPE_DISCOUNT = 3;

    const USE_TIME_TYPE_FIXED    = 1;
    const USE_TIME_TYPE_RELATIVE = 2;

    const COUPON_STATUS_NO_USED = 0;
    const COUPON_STATUS_USED    = 1;
    const COUPON_STATUS_LOCK    = 2;

    public const COUPON_STATUS_TEXT = [
        self::COUPON_STATUS_NO_USED => '待使用',
        self::COUPON_STATUS_USED    => '已核销',
        self::COUPON_STATUS_LOCK    => '已锁定'
    ];

    const COUPON_SHOP_TYPE_ALl      = 0;
    const COUPON_SHOP_TYPE_JOIN     = 1;
    const COUPON_SHOP_TYPE_DIRECTLY = 2;
    const COUPON_SHOP_TYPE_PART     = 3;

    const COUPON_CODE_LENGTH = 14;

    const COUPON_UNABLE_DATE_HOLIDAY = 8;

    //1 pos 2微信小程序 4美团外卖 8: 饿了么
    public const COUPON_SOURCE_1  = 1;
    public const COUPON_SOURCE_2  = 2;
    public const COUPON_SOURCE_4  = 4;
    public const COUPON_SOURCE_8  = 8;
    public const COUPON_SOURCE_16 = 16;

    //订单来源
    public const COUPON_SOURCE_CHANGE_1 = 1;//pos
    public const COUPON_SOURCE_CHANGE_2 = 2;//微信小程序
    public const COUPON_SOURCE_CHANGE_3 = 3;//美团外卖
    public const COUPON_SOURCE_CHANGE_4 = 4;//饿了么

    public const COUPON_INIT_TYPE_CHECK  = 1;//检查
    public const COUPON_INIT_TYPE_SELECT = 0;//选择

    public const COUPON_DAY_TIME       = 86400;
    public const COUPON_DAY_DIFFERENCE = 0;
    public const COUPON_DAY_TOMORROW   = 1;


    public const COUPON_TYPE_TEXT = [
        self::COUPON_TYPE_CASH     => '代金券',
        self::COUPON_TYPE_EXCHANGE => '商品券',
        self::COUPON_TYPE_DISCOUNT => '折扣券'
    ];

    public const COUPON_USE_TIME_TYPE_TEXT = [
        self::USE_TIME_TYPE_FIXED    => '固定有效期',
        self::USE_TIME_TYPE_RELATIVE => '相对有效期'
    ];



    public const COUPON_SHOP_TYPE_TEXT = [
        self::COUPON_SHOP_TYPE_ALl      => '全部',
        self::COUPON_SHOP_TYPE_JOIN     => '加盟',
        self::COUPON_SHOP_TYPE_DIRECTLY => '直营',
        self::COUPON_SHOP_TYPE_PART     => '部分'
    ];

    public const COUPON_SOURCE_CHANGE_TEXT = [
        self::COUPON_SOURCE_CHANGE_1 => self::COUPON_SOURCE_1,//pos
        self::COUPON_SOURCE_CHANGE_2 => self::COUPON_SOURCE_2,//微信小程序
        self::COUPON_SOURCE_CHANGE_3 => self::COUPON_SOURCE_4,//美团
        self::COUPON_SOURCE_CHANGE_4 => self::COUPON_SOURCE_8,//饿了么
    ];

    public const CUSTOMER_COUPON_STATUS_EXPIRE        = 0; //失效
    public const CUSTOMER_COUPON_STATUS_EFFECTIVE     = 1;//已生效
    public const CUSTOMER_COUPON_STATUS_NOT_EFFECTIVE = 2;//未生效
    public const CUSTOMER_COUPON_STATUS_USED          = 3;//已使用

    public static function CouponSourceChange($orderSource): int
    {
        return self::COUPON_SOURCE_CHANGE_TEXT[$orderSource];
    }


    const EXPIRE_NOTICE_YES = 1;
    const EXPIRE_NOTICE_NO  = 0;


    const ARRIVAL_NOTICE_YES = 1;
    const ARRIVAL_NOTICE_NO  = 0;

    // availableSource : 0和3 目前代表全部
    const AVAILABLE_SOURCE_ALL = 0;
    const AVAILABLE_SOURCE_ONE = 1;
    const AVAILABLE_SOURCE_TWO = 2;
    const AVAILABLE_SOURCE_ALL_THREE = 3;


}
